package cn.javass.dp.builder.example2;

import java.util.Collection;
import java.util.Map;

public class ExportToXml {
    public void export(ExportHeaderModel ehm, Map<String, Collection<ExportDataModel>> mapData, ExportFooterModel efm) {
        StringBuffer buffer = new StringBuffer();

        buffer.append("<?xml version='1.0' encoding='gb2132' ?>\n");
        buffer.append("<depId>"+ehm.getDepId()+"</depId>+\n");
        buffer.append("<Exportdate>"+ehm.getDepId()+"</Exportdate>+\n");
        for (String tblName : mapData.keySet()) {
            buffer.append("<>"+tblName+"</>\n");

            for (ExportDataModel edm : mapData.get(tblName)) {
                buffer.append("<>"+edm.getProductId()+"</>\n");
                buffer.append("<>"+edm.getPrice()+"</>\n");
                buffer.append("<>"+edm.getAmount()+"</>\n");
            }
        }
        buffer.append("<>"+efm.getExportUser()+"</>+\n");
        System.out.println("xml输出 = " + buffer);
    }
}
